<!DOCTYPE html>
<html>
<head>
    <title>我的数据</title>
<#include "/common/include_header.ftl">
</head>
<body>

<#include "/common/include_top.ftl">

<div class="layui-container fly-marginTop fly-user-main">

<#include "/common/include_menu.ftl">

    <div class="site-tree-mobile layui-hide">
        <i class="layui-icon">&#xe602;</i>
    </div>
    <div class="site-mobile-shade"></div>

    <div class="site-tree-mobile layui-hide">
        <i class="layui-icon">&#xe602;</i>
    </div>
    <div class="site-mobile-shade"></div>


    <div class="fly-panel fly-panel-user" pad20>
        <!--
        <div class="fly-msg" style="margin-top: 15px;">
          您的邮箱尚未验证，这比较影响您的帐号安全，<a href="activate.html">立即去激活？</a>
        </div>
        -->
        <div class="layui-tab layui-tab-brief" lay-filter="user">
            <ul class="layui-tab-title" id="LAY_mine">
                <li data-type="mine-jie" lay-id="index" class="layui-this">我的表格数据（<span>${tableData?size}</span>）</li>
                <li data-type="collection" data-url="/collection/find/" lay-id="collection">我的文本数据（<span>${jsonData?size}</span>）</li>
                <a href="/data/save">
                    <button class="layui-btn" style="float: right;">
                        <i class="layui-icon">&#xe608;</i> 创建我的数据
                    </button>
                </a>
            </ul>

            <div class="layui-tab-content" style="padding: 20px 0;">
                <div class="layui-tab-item layui-show">

                    <ul class="mine-view jie-row">

                    <#list tableData as data>
                        <li>
                            <a class="jie-title" href="/data/${data.id}/info">${data.title}</a>
                            <i>${data.createTime}</i>
                        <#--<a class="mine-edit" href="/data/${data.id}/info">编辑</a>-->
                            <a class="mine-edit" href="/data/${data.id}/info">编辑</a>
                            <a onclick="deleted('${data.id}')" class="mine-edit layui-bg-orange" >删除</a>

                            <#--<button data-method="offset" data-type="auto" class="layui-btn layui-btn-normal">居中弹出</button>-->

                            <em>${data.readNum}阅/${data.likeNum}喜欢/${data.collectNum}收藏</em>
                        </li>
                    </#list>

                    </ul>
                    <div id="LAY_page"></div>
                </div>
                <div class="layui-tab-item">
                    <ul class="mine-view jie-row">

                    <#list jsonData as data>
                        <li>
                            <a class="jie-title" href="/data/${data.id}/info">${data.title}</a>
                            <i>${data.createTime}</i>
                        <#--<a class="mine-edit" href="/data/${data.id}/info">编辑</a>-->
                            <a class="mine-edit" href="/data/${data.id}/info">编辑</a>
                            <a onclick="deleted('${data.id}')" class="mine-edit layui-bg-orange" >删除</a>

                            <em>${data.readNum}阅/${data.likeNum}喜欢/${data.collectNum}收藏</em>
                        </li>
                    </#list>

                    <#--<li>-->
                    <#--<a class="jie-title" href="../jie/detail.html" target="_blank">用户点击量json数据</a>-->
                    <#--<i>收藏于23小时前</i></li>-->
                    </ul>
                    <div id="LAY_page1"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function deleted(dataId) {
        layer.open({
            title: '-'
            ,content: '确认删除该数据？'
            ,yes: function(layero, index){
                $.ajax({
                url: '${basePath}/data/' + dataId + '/delete',
                <#--url: '/data/${dataInfo.id}/addColumn',-->
                type: 'post',
                dataType: 'json',
                success: function (rd) {
                    if (rd.suc) {
                        window.location.href = "${basePath}/user/data";
                    } else {
                        layer.msg(rd.msg, {icon: 2});
                    }
                }
            });
            }
        });

    }
</script>




<#include "/common/include_footer.ftl">
<#include "/common/include_js.ftl">
</body>
</html>